26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
50 #pragma package(smart_init)
63 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
65 for(
int x = 0; x < 4; x++)
76 else if(SpeedTagVal == 77)
80 else if(SpeedTagVal == 78)
84 else if(SpeedTagVal == 79)
88 else if(SpeedTagVal == 96)
92 else if(SpeedTagVal == 129)
96 else if(SpeedTagVal == 130)
100 else if(SpeedTagVal == 131)
104 else if(SpeedTagVal == 145)
108 else if(SpeedTagVal == 146)
117 FixedNamedLocationElement(false)
119 for(
int x = 0; x < 4; x++)
130 AnsiString(VLocInput));
143 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
157 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
173 Graphics::TBitmap *GraphicOutput = GraphicPtr;
175 if(LocationName ==
"")
220 GraphicOutput = GraphicPtr;
224 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
233 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
234 AnsiString(TrainIDOnBridgeTrackPos01) +
"," + AnsiString(TrainIDOnBridgeTrackPos23) +
",EndTrkEl,";
243 if(lower.second < higher.second)
247 else if(lower.second > higher.second)
251 else if(lower.second == higher.second)
253 if(lower.first < higher.first)
266 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
267 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
271 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
282 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
310 {2, 4}, {6, 2}, {8, 6}, {4, 8},
311 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
321 else if(
Link[2] == -1)
334 else if(
Link[2] == -1)
343 for(
int x = 0; x < 16; x++)
345 if((Entry == EXArray[x][0]) && (Exit == EXArray[x][1]) || (Entry == EXArray[x][1]) && (Exit == EXArray[x][0]))
521 throw Exception(
"Error in EntryExitNumber 4");
616 throw Exception(
"Error in EntryExitNumber 5");
713 throw Exception(
"Error in EntryExitNumber 6");
803 throw Exception(
"Error in EntryExitNumber 10");
893 throw Exception(
"Error in EntryExitNumber 11");
989 throw Exception(
"Error in EntryExitNumber 7");
1020 throw Exception(
"Error in EntryExitNumber 8");
1031 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1033 if(!AutoSigsFlag && !PrefDirRoute)
1037 else if(!AutoSigsFlag && PrefDirRoute)
1048 throw Exception(
"Error in EntryExitNumber 9");
1092 TTrack::TActiveLevelCrossing::TActiveLevelCrossing()
1117 AnsiString NL =
'\n';
1119 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable; " + NL + NL +
1120 "reachable but with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1121 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1122 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1129 int InternalLinkCheckArray[9][2] =
1130 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1135 for(
int x = 0; x < 9; x++)
1137 for(
int y = 0; y < 2; y++)
1144 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1146 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1147 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1148 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1149 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 20 << 21 << 22 << 23 << 24 << 25 << 26 << 27
1150 << 60 << 61 << 62 << 63 << 68 << 69 << 70 << 71 << 80 << 81 << 82 << 83 << 125 << 126 << 127 << 128;
1156 int HVArray[10][2] =
1157 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1159 for(
int x = 0; x < 10; x++)
1161 for(
int y = 0; y < 2; y++)
1170 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1173 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1174 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1176 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1177 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1179 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1180 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1183 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1186 for(
int x = 0; x < 40; x++)
1192 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1195 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1196 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1198 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1199 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1201 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1202 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1205 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1208 for(
int x = 0; x < 40; x++)
1214 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1217 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1218 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1220 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1221 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1223 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1224 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1227 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1230 for(
int x = 0; x < 40; x++)
1256 for(
int x = 0; x < 40; x++)
1283 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1284 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1285 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1286 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1287 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1288 {0, 0, 129}, {0, -1, 145},
1291 for(
int x = 0; x < 25; x++)
1293 for(
int y = 0; y < 3; y++)
1301 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1302 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1303 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1304 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1305 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1306 {0, 0, 129}, {0, 1, 145},
1309 for(
int x = 0; x < 25; x++)
1311 for(
int y = 0; y < 3; y++)
1319 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1320 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1321 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1322 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1323 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1324 {0, 0, 130}, {-1, 0, 146},
1327 for(
int x = 0; x < 25; x++)
1329 for(
int y = 0; y < 3; y++)
1337 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1338 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1339 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1340 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1341 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1342 {0, 0, 130}, {1, 0, 146},
1345 for(
int x = 0; x < 25; x++)
1347 for(
int y = 0; y < 3; y++)
1355 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1356 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1357 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1358 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1359 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1360 {0, -1, 129}, {1, 0, 130},
1361 {-1, 0, 130}, {0, 1, 145},
1362 {0, -1, 145}, {1, 0, 146},
1365 for(
int x = 0; x < 28; x++)
1367 for(
int y = 0; y < 3; y++)
1385 for(
int x = 0; x < 8; x++)
1387 for(
int y = 0; y < 3; y++)
1405 for(
int x = 0; x < 8; x++)
1407 for(
int y = 0; y < 3; y++)
1425 for(
int x = 0; x < 8; x++)
1427 for(
int y = 0; y < 3; y++)
1445 for(
int x = 0; x < 8; x++)
1447 for(
int y = 0; y < 3; y++)
1455 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1457 for(
int x = 0; x < 4; x++)
1459 for(
int y = 0; y < 3; y++)
1467 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1468 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1469 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1470 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1476 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1477 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1478 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1479 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1485 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1486 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1487 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1488 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1494 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1495 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1496 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1497 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1519 delete UGMIt->second;
1595 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1596 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1598 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1605 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1606 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1619 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1620 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1622 {4, 6, 2, 8}, {1, 9, 3, 7},
1624 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1626 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1629 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1630 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1631 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1632 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1633 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1634 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1635 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1637 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1638 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1639 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1640 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1641 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1642 {4, 6, -1, -1}, {2, 8, -1, -1},
1644 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1646 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1648 {4, 6, -1, -1}, {2, 8, -1, -1},
1653 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1654 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1655 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1656 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1659 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1660 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1661 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1663 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1664 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1665 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1667 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1669 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1670 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1671 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1672 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1673 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1674 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1675 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1676 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1677 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1678 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1679 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1680 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1681 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1683 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1684 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1685 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1686 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1687 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1688 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1689 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1690 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1694 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1695 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1696 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1702 for(
int x = 0; x < 17; x++)
1704 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1706 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1710 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1716 ExistingGraphicLoaded(false), Width(16), Height(16)
1728 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1766 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1770 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1774 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1778 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1801 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1804 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1808 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1812 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1846 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1867 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1881 bool TrackPresent =
false;
1895 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1899 TrackPresent =
true;
1904 return(!TrackPresent);
1912 bool TrackPresent =
false;
1921 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1925 TrackPresent =
true;
1931 return(!TrackPresent);
1936 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
1939 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
1940 TrackEraseSuccessfulFlag =
false;
1945 ErasedTrackVectorPosition = -1;
1946 AnsiString SName =
"", ErrorString;
1948 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
1954 TrackMapKeyPair.first = HLocInput;
1955 TrackMapKeyPair.second = VLocInput;
1956 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
1967 if(ErrorString !=
"")
1969 throw Exception(ErrorString +
" for EraseTrackElement 1");
1993 ErasedTrackVectorPosition = VecPos;
1994 TrackEraseSuccessfulFlag =
true;
2000 unsigned int VecPos;
2001 InactiveTrackMapKeyPair.first = HLocInput;
2002 InactiveTrackMapKeyPair.second = VLocInput;
2007 VecPos = InactiveTrack2MultiMapIterator->second;
2012 if(ErrorString !=
"")
2014 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2024 TrackEraseSuccessfulFlag =
true;
2045 VecPos = InactiveTrack2MultiMapIterator->second;
2050 if(ErrorString !=
"")
2052 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2076 if(TrackEraseSuccessfulFlag)
2098 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2099 bool PlatAllowedFlag =
false;
2101 TrackLinkingRequiredFlag =
false;
2113 LocationNameEntry.first =
"";
2121 TempTrackElement.
HLoc = HLocInput;
2122 TempTrackElement.
VLoc = VLocInput;
2148 else if(Aspect == 1)
2152 else if(Aspect == 2)
2156 else if(Aspect == 3)
2165 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2168 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2170 if(InactiveFoundFlag)
2174 NonStationOrLevelCrossingPresent =
true;
2178 NonStationOrLevelCrossingPresent =
true;
2182 PlatformPresent =
true;
2193 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2201 PlatAllowedFlag =
true;
2205 PlatAllowedFlag =
true;
2209 PlatAllowedFlag =
true;
2213 PlatAllowedFlag =
true;
2217 TrackLinkingRequiredFlag =
true;
2245 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2246 (!FoundFlag && !InactiveFoundFlag))
2249 TrackLinkingRequiredFlag =
true;
2281 TrackLinkingRequiredFlag =
true;
2293 else if(FoundFlag || InactiveFoundFlag)
2312 bool BothPointFillets =
true;
2327 TrackLinkingRequiredFlag =
true;
2341 bool InternalChecks)
2345 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2346 bool PlatAllowedFlag =
false;
2348 TrackLinkingRequiredFlag =
false;
2351 LocationNameEntry.first =
"";
2357 TempTrackElement.
HLoc = HLocInput;
2358 TempTrackElement.
VLoc = VLocInput;
2359 for(
int x = 0; x < 4; x++)
2365 TempTrackElement.
Conn[x] = -1;
2369 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2380 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2382 if(InactiveFoundFlag)
2386 NonStationOrLevelCrossingPresent =
true;
2390 NonStationOrLevelCrossingPresent =
true;
2394 PlatformPresent =
true;
2405 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2413 PlatAllowedFlag =
true;
2417 PlatAllowedFlag =
true;
2421 PlatAllowedFlag =
true;
2425 PlatAllowedFlag =
true;
2429 TrackLinkingRequiredFlag =
true;
2460 if((FoundFlag && (
NameAllowed.Contains(
TrackVector.at(VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2461 (!FoundFlag && !InactiveFoundFlag))
2464 TrackLinkingRequiredFlag =
true;
2499 TrackLinkingRequiredFlag =
true;
2511 else if(FoundFlag || InactiveFoundFlag)
2530 bool BothPointFillets =
true;
2545 TrackLinkingRequiredFlag =
true;
2575 ShowMessage(
"Gaps must be set before track can be validated");
2585 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2596 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2613 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2620 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2644 std::pair<AnsiString, char>TempMapPair;
2652 TempMapPair.second =
'x';
2665 int NewHLoc, NewVLoc;
2666 bool ConnectionFoundFlag, LinkFoundFlag;
2668 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2670 for(
unsigned int y = 0; y < 4; y++)
2688 ConnectionFoundFlag =
false;
2689 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2695 ConnectionFoundFlag =
true;
2697 LinkFoundFlag =
false;
2698 for(
unsigned int a = 0; a < 4; a++)
2702 LinkFoundFlag =
true;
2718 if(!ConnectionFoundFlag)
2793 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2810 bool UnsetGaps =
false;
2817 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2821 for(
unsigned int y = 0; y < 4; y++)
2833 for(
unsigned int y = 0; y < 4; y++)
2843 for(
unsigned int y = 1; y < 4; y++)
2852 for(
unsigned int y = 0; y < 4; y++)
2865 for(
unsigned int y = 0; y < 4; y++)
2893 int NumberOfActiveElements = 0;
2895 GraphicsFollow =
false;
2899 if(MarkerString[MarkerString.Length()] ==
'1')
2901 GraphicsFollow =
true;
2903 for(
int x = 0; x < NumberOfActiveElements; x++)
2909 TrackElement.
HLoc = TempInt;
2911 TrackElement.
VLoc = TempInt;
2917 TrackElement.
Conn[0] = TempInt;
2941 if((TempInt != -1) && (TempInt < 10))
2951 if((TempInt != -1) && (TempInt < 10))
2968 if(Marker[1] ==
'3')
2972 else if(Marker[1] ==
'2')
2976 else if(Marker[1] ==
'G')
2990 int NumberOfInactiveElements = 0;
2994 for(
int x = 0; x < NumberOfInactiveElements; x++)
3000 TrackElement.
HLoc = TempInt;
3002 TrackElement.
VLoc = TempInt;
3008 bool LocError =
false;
3037 for(
int x = 0; x < NumberOfGraphics; x++)
3048 bool FileError =
false;
3050 for(
int x = 0; x < NumberOfGraphics; x++)
3063 UGME.second =
new TPicture;
3064 UGME.second->LoadFromFile(
UGME.first);
3067 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3074 catch(
const EInvalidGraphic &e)
3083 delete UGMIt->second;
3088 catch(
const Exception &e)
3097 delete UGMIt->second;
3105 bool FoundInMap =
false;
3124 UGME.second =
new TPicture;
3125 UGME.second->LoadFromFile(
UGME.first);
3128 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3135 catch(
const EInvalidGraphic &e)
3144 delete UGMIt->second;
3149 catch(
const Exception &e)
3158 delete UGMIt->second;
3183 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3187 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3189 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3192 VecFile << x <<
'\n';
3193 VecFile << TrackElement.
SpeedTag <<
'\n';
3194 VecFile << TrackElement.
HLoc <<
'\n';
3195 VecFile << TrackElement.
VLoc <<
'\n';
3199 VecFile << TrackElement.
Conn[0] <<
'\n';
3203 VecFile << TrackElement.
Attribute <<
'\n';
3209 VecFile << int(1) <<
'\n';
3213 VecFile << int(0) <<
'\n';
3216 VecFile << TrackElement.
Length01 <<
'\n';
3217 VecFile << TrackElement.
Length23 <<
'\n';
3220 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3227 VecFile <<
"3*****" <<
'\0' <<
'\n';
3231 VecFile <<
"2*****" <<
'\0' <<
'\n';
3235 VecFile <<
"G*****" <<
'\0' <<
'\n';
3239 VecFile <<
"4*****" <<
'\0' <<
'\n';
3244 VecFile <<
"******" <<
'\0' <<
'\n';
3249 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3253 VecFile << x <<
'\n';
3254 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3255 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3256 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3257 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3258 VecFile <<
"******" <<
'\0' <<
'\n';
3273 GraphicsFollow =
false;
3275 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3281 AnsiString MarkerString;
3288 if(MarkerString[MarkerString.Length()] ==
'1')
3290 GraphicsFollow =
true;
3292 for(
int x = 0; x < NumberOfActiveElements; x++)
3300 int SpeedTag = TempInt;
3307 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3313 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3318 if((SpeedTag > 87) && (SpeedTag < 96))
3321 if((TempInt < -1) || (TempInt > 3))
3327 if((TempInt < -1) || (TempInt > 999999))
3333 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3334 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3337 if((TempInt < -1) || (TempInt > 5))
3343 if((SpeedTag >= 68) && (SpeedTag <= 75))
3346 if((TempInt != 0) && (TempInt != 1))
3353 if((TempInt < -1) || (TempInt > 999999))
3359 if((TempInt < -1) || (TempInt > 999999))
3365 if((TempInt < -1) || (TempInt > 999999))
3371 if((TempInt < -1) || (TempInt > 999999))
3392 int NumberOfInactiveElements = 0;
3395 if(NumberOfInactiveElements < 0)
3405 for(
int x = 0; x < NumberOfInactiveElements; x++)
3419 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3425 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3452 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3458 AnsiString FileName =
"", TempStr =
"";
3460 for(
int x = 0; x < NumberOfGraphics; x++)
3462 TPicture *TempPicture =
new TPicture;
3471 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3484 catch(
const EInvalidGraphic &e)
3489 for(
int y = x + 1; y < NumberOfGraphics; y++)
3495 ShowMessage(FileName +
3496 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3501 catch(
const Exception &e)
3506 for(
int y = x + 1; y < NumberOfGraphics; y++)
3512 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3513 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3531 for(
int x = 0; x < VecSize; x++)
3554 for(
int x = 0; x < VecSize; x++)
3576 for(
int x = 0; x < VecSize; x++)
3630 for(
int x = 0; x < VecSize; x++)
3688 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3706 if(BothPointFilletsAndBasicLCs)
3781 Bitmap->Canvas->CopyMode = cmSrcCopy;
3783 Graphics::TBitmap *GraphicOutput;
3955 for(
int x = 0; x < 40; x++)
3984 Graphics::TBitmap *GraphicPtr;
3999 Graphics::TBitmap* SignalPlatformGraphic;
4032 if(OldTransparentColour !=
clB5G5R5)
4055 Bitmap->Canvas->CopyMode = cmSrcCopy;
4083 Bitmap->Canvas->CopyMode = cmSrcCopy;
4085 Graphics::TBitmap *GraphicOutput;
4095 if(BaseElement == 1)
4183 for(
int x = 0; x < 40; x++)
4212 Graphics::TBitmap *GraphicPtr;
4227 Graphics::TBitmap* SignalPlatformGraphic;
4288 for(
int x = 0; x < 40; x++)
4296 Graphics::TBitmap* SignalPlatformGraphic;
4317 if(OldTransparentColour !=
clB5G5R5)
4331 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4403 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4417 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4443 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4468 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4498 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4532 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4569 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4584 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4613 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4620 throw Exception(
"Error - Map & Vector different sizes");
4622 unsigned int NonZeroCount = 0;
4624 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4633 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4639 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4643 TrackMapEntry.first = TrackMapKeyPair;
4644 TrackMapEntry.second = x;
4645 if(!(
TrackMap.insert(TrackMapEntry).second))
4647 throw Exception(
"Error - map insertion failure, TrackVector in error");
4651 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4653 for(
unsigned int y = 0; y < 4; y++)
4678 THVPair GapMapKeyPair, GapMapValuePair;
4681 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4687 GapMapEntry.first = GapMapKeyPair;
4690 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4694 GapMapEntry.second = GapMapValuePair;
4697 GapMap.insert(GapMapEntry);
4710 bool CheckForLinks =
false;
4712 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4724 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4725 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4726 "can't connect to an underpass or vice versa)");
4734 for(
unsigned int y = 0; y < 4; y++)
4736 CheckForLinks =
false;
4754 bool ConnectionFoundFlag;
4758 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4764 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4773 if(ConnectionFoundFlag)
4777 bool LinkFoundFlag =
false;
4781 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
4787 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
4793 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
4801 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
4807 ShowMessage(
"Signal facing a bridge - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
4814 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
4818 CheckForLinks =
true;
4822 for(
unsigned int a = 0; a < 4; a++)
4831 LinkFoundFlag =
true;
4844 throw Exception(
"Error in final track linkage - invalid link");
4858 throw Exception(
"Error in final track linkage - connection not found");
4871 bool ConnErrorFlag =
false;
4873 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4877 ConnErrorFlag =
true;
4881 ConnErrorFlag =
true;
4885 ConnErrorFlag =
true;
4889 ConnErrorFlag =
true;
4893 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
4895 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
4897 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
4906 throw Exception(
"ConnError in LinkTrack - Final");
4910 throw Exception(
"ConnError in LinkTrack - Precheck");
4913 bool CLkErrorFlag =
false;
4915 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4919 CLkErrorFlag =
true;
4923 CLkErrorFlag =
true;
4927 CLkErrorFlag =
true;
4931 CLkErrorFlag =
true;
4939 throw Exception(
"CLkError in LinkTrack - Final");
4943 throw Exception(
"CLkError in LinkTrack - Precheck");
4947 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4977 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4993 for(
unsigned int y = 0; y < 4; y++)
5012 bool ConnectionFoundFlag;
5018 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5027 if(ConnectionFoundFlag)
5030 bool LinkFoundFlag =
false;
5087 for(
unsigned int a = 0; a < 4; a++)
5096 LinkFoundFlag =
true;
5104 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5114 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5127 bool ConnErrorFlag =
false;
5129 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5133 ConnErrorFlag =
true;
5137 ConnErrorFlag =
true;
5141 ConnErrorFlag =
true;
5145 ConnErrorFlag =
true;
5149 if(
TrackVector.at(x).ActiveTrackElementName ==
"")
5151 if((
TrackVector.at(x).StationEntryStopLinkPos1 != -1) || (
TrackVector.at(x).StationEntryStopLinkPos2 != -1))
5153 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5162 throw Exception(
"ConnError in LinkTrack - Final");
5166 throw Exception(
"ConnError in LinkTrack - Precheck");
5169 bool CLkErrorFlag =
false;
5171 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5175 CLkErrorFlag =
true;
5179 CLkErrorFlag =
true;
5183 CLkErrorFlag =
true;
5187 CLkErrorFlag =
true;
5195 throw Exception(
"CLkError in LinkTrack - Final");
5199 throw Exception(
"CLkError in LinkTrack - Precheck");
5203 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5232 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5248 for(
unsigned int y = 0; y < 4; y++)
5267 bool ConnectionFoundFlag =
false;
5269 if(ConnectionFoundFlag)
5273 bool LinkFoundFlag =
false;
5293 for(
unsigned int a = 0; a < 4; a++)
5302 LinkFoundFlag =
true;
5322 bool ConnErrorFlag =
false;
5324 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5328 ConnErrorFlag =
true;
5332 ConnErrorFlag =
true;
5336 ConnErrorFlag =
true;
5340 ConnErrorFlag =
true;
5348 bool CLkErrorFlag =
false;
5350 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5354 CLkErrorFlag =
true;
5358 CLkErrorFlag =
true;
5362 CLkErrorFlag =
true;
5366 CLkErrorFlag =
true;
5384 int Position1, Position2;
5390 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5392 int HLoc1 = GapMapPtr->first.first;
5393 int VLoc1 = GapMapPtr->first.second;
5394 int HLoc2 = GapMapPtr->second.first;
5395 int VLoc2 = GapMapPtr->second.second;
5398 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5402 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5406 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5410 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5428 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5429 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5439 bool FoundFlag =
false;
5451 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5452 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5453 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5482 bool FoundFlag =
false;
5495 TrackMapKeyPair.first = TrackElement.
HLoc;
5496 TrackMapKeyPair.second = TrackElement.
VLoc;
5497 TrackMapEntry.first = TrackMapKeyPair;
5502 LocationNameEntry.second = -(int)(
TrackVector.size());
5542 TrackMapKeyPair.first = HLoc;
5543 TrackMapKeyPair.second = VLoc;
5544 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5554 return(TrackMapPtr->second);
5567 TrackMapKeyPair.first = HLoc;
5568 TrackMapKeyPair.second = VLoc;
5569 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5572 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5573 throw Exception(Message);
5591 MapKeyPair.first = HLoc;
5592 MapKeyPair.second = VLoc;
5593 MapPtr = Map.find(MapKeyPair);
5594 if(MapPtr == Map.end())
5596 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5597 throw Exception(Message);
5602 return(Vector.at(MapPtr->second));
5612 THVPair InactiveTrackMapKeyPair;
5615 InactiveTrackMapKeyPair.first = HLoc;
5616 InactiveTrackMapKeyPair.second = VLoc;
5620 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5621 throw Exception(Message);
5635 bool Present =
true;
5639 TrackMapKeyPair.first = HLoc;
5640 TrackMapKeyPair.second = VLoc;
5641 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5656 bool Present =
true;
5657 THVPair InactiveTrackMapKeyPair;
5660 InactiveTrackMapKeyPair.first = HLoc;
5661 InactiveTrackMapKeyPair.second = VLoc;
5679 THVPair InactiveTrackMapKeyPair;
5684 InactiveTrackMapKeyPair.first = HLoc;
5685 InactiveTrackMapKeyPair.second = VLoc;
5694 if(InactiveTrackRange.first == InactiveTrackRange.second)
5703 RetPair.first = InactiveTrackRange.first->second;
5704 RetPair.second = (--InactiveTrackRange.second)->second;
5717 AnsiString(DivergingPosition));
5728 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
5729 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
5730 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
5731 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
5732 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
5733 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
5734 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
5735 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
5736 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
5737 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
5738 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
5739 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
5773 throw Exception(
"Error, Wrong track type in PlotGap");
5775 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
5779 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
5783 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
5787 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
5791 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
5795 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
5799 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
5803 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
5807 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
5811 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
5815 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
5819 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
5823 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
5827 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
5831 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
5835 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
5849 throw Exception(
"Error, Wrong track type in PlotPoints");
5860 else if(TrackElement.
SpeedTag < 132)
5878 else if(TrackElement.
SpeedTag < 132)
5911 throw Exception(
"Error, Wrong track type in PlotSignal");
5913 for(
int x = 0; x < 40; x++)
5984 for(
int x = 0; x < 40; x++)
5991 Graphics::TBitmap* SignalPlatformGraphic;
6078 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6086 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6094 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6102 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6118 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6126 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6134 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6142 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6175 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6187 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6199 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6211 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6253 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6255 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6257 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6260 if(BaseElementSpeedTag == 1)
6264 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6271 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6279 Graphics::TBitmap *RouteGraphic;
6281 if(TypeOfRoute == 1)
6285 else if(TypeOfRoute == 0)
6291 RouteGraphic = BaseGraphic;
6298 if(UpStep == DownStep)
6301 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6311 else if((DownStep - UpStep) == 1)
6316 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6326 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6339 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6349 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6365 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6375 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6385 else if(DownStep == 0)
6388 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6398 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6411 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6421 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6431 for(
int x = (UpStep + 1); x < DownStep; x++)
6436 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6440 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6461 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6468 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6474 Graphics::TBitmap *RouteGraphic;
6476 if(TypeOfRoute == 1)
6480 else if(TypeOfRoute == 0)
6486 RouteGraphic = BaseGraphic;
6495 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6505 else if((RStep - LStep) == 1)
6510 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6520 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6533 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6543 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6559 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6569 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6582 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6592 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6605 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6615 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6625 for(
int x = (LStep + 1); x < RStep; x++)
6630 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
6634 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
6658 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6661 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6663 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6665 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
6668 if(BaseElementSpeedTag == 1)
6672 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
6679 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
6685 if(UpStep == DownStep)
6696 else if((DownStep - UpStep) == 1)
6715 for(
int x = (UpStep + 1); x < DownStep; x++)
6724 for(
int x = (UpStep + 1); x < DownStep; x++)
6731 for(
int x = UpStep; x <= DownStep; x++)
6744 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
6751 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
6768 else if((RStep - LStep) == 1)
6787 for(
int x = (LStep + 1); x < RStep; x++)
6796 for(
int x = (LStep + 1); x < RStep; x++)
6803 for(
int x = LStep; x <= RStep; x++)
6822 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
6824 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6826 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
6829 if(BaseElementSpeedTag == 1)
6833 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
6840 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
6846 for(
int x = UpStep; x < (DownStep + 1); x++)
6861 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
6868 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
6874 for(
int x = LStep; x < (RStep + 1); x++)
6893 AnsiString(HLoc) +
"," + AnsiString(VLoc));
6896 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6898 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6900 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
6905 if(BaseElementSpeedTag == 1)
6909 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
6916 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
6922 for(
int x = UpStep; x <= DownStep; x++)
6936 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
6943 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
6949 for(
int x = LStep; x <= RStep; x++)
6965 Graphics::TBitmap *RouteGraphic;
6968 if(BaseElementSpeedTag == 1)
6970 if(TypeOfRoute == 1)
6974 else if(TypeOfRoute == 0)
6980 RouteGraphic = BaseGraphic;
6984 RouteGraphic = BaseGraphic;
6990 if(TypeOfRoute == 1)
6994 else if(TypeOfRoute == 0)
7000 RouteGraphic = BaseGraphic;
7004 RouteGraphic = BaseGraphic;
7009 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7014 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7018 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7025 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7028 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7033 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7038 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7042 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7049 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7052 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7177 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7181 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7212 "," + AnsiString(VLoc));
7216 int DummyRouteNumber;
7218 TrainPresent =
false;
7222 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7224 TrackMapKeyPair.first = HLoc;
7225 TrackMapKeyPair.second = VLoc + UpStep;
7226 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7235 TrainPresent =
true;
7249 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7251 TrackMapKeyPair.first = HLoc;
7252 TrackMapKeyPair.second = VLoc + DownStep;
7253 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7262 TrainPresent =
true;
7276 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7278 TrackMapKeyPair.first = HLoc + LeftStep;
7279 TrackMapKeyPair.second = VLoc;
7280 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7289 TrainPresent =
true;
7303 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7305 TrackMapKeyPair.first = HLoc + RightStep;
7306 TrackMapKeyPair.second = VLoc;
7307 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7316 TrainPresent =
true;
7336 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7353 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7356 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7362 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7369 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7375 for(
int x = UpStep; x <= DownStep; x++)
7382 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7389 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7395 for(
int x = LStep; x <= RStep; x++)
7411 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7418 else if(TrackElement.
SpeedTag < 132)
7436 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7453 AnsiString(ScreenPosV));
7468 AnsiString(ScreenPosV));
7479 AnsiString(VPosTrue));
7493 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7505 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7506 " in TrackMap, Caller=" + (AnsiString)Caller);
7508 if(MapVecPos != (
int)a)
7510 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7511 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7512 (AnsiString)Caller);
7518 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7519 " Caller=" + (AnsiString)Caller);
7539 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7540 " in InactiveMap, Caller=" + (AnsiString)Caller);
7542 if((InactivePair.first != a) && (InactivePair.second != a))
7544 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7545 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7546 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7551 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7552 " Caller=" + (AnsiString)Caller);
7562 int Position1, Position2;
7568 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7570 int HLoc1 = GapMapPtr->first.first;
7571 int VLoc1 = GapMapPtr->first.second;
7572 int HLoc2 = GapMapPtr->second.first;
7573 int VLoc2 = GapMapPtr->second.second;
7576 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7580 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7584 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7588 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7592 unsigned int GapCount = 0;
7594 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7602 if((
GapMap.size() * 2) != GapCount)
7604 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7605 (AnsiString)Caller);
7615 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7619 throw Exception(
"Error - TrackFinished with erase element still present");
7624 AnsiString IDString;
7626 if(TrackElement.
HLoc < 0)
7628 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
7632 IDString = AnsiString(TrackElement.
HLoc) +
"-";
7634 if(TrackElement.
VLoc < 0)
7636 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
7640 IDString += AnsiString(TrackElement.
VLoc);
7654 for(
int x = 1; x < String.Length() + 1; x++)
7656 if(String.IsDelimiter(
"-", x))
7661 if(x == String.Length())
7665 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
7675 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
7680 if(DelimPos == String.Length())
7684 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
7689 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
7693 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
7700 if(String.SubString(1, 1) !=
"N")
7702 for(
int x = 1; x < DelimPos; x++)
7704 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7708 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7715 if(String.SubString(1, 1) ==
"N")
7717 for(
int x = 2; x < DelimPos; x++)
7719 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7723 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
7730 if(String.SubString(1, 1) ==
"N")
7732 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
7736 HLoc = String.SubString(1, DelimPos - 1).ToInt();
7738 if(String.SubString(DelimPos + 1, 1) !=
"N")
7740 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
7742 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7746 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7753 if(String.SubString(DelimPos + 1, 1) ==
"N")
7755 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
7757 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
7761 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
7768 if(String.SubString(DelimPos + 1, 1) ==
"N")
7770 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
7774 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
7779 TrackMapPtr =
TrackMap.find(HVPair);
7784 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
7790 return(TrackMapPtr->second);
7801 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
7802 int HLoc = TrackElement.
HLoc;
7803 int VLoc = TrackElement.
VLoc;
7906 AnsiString(SpeedTag));
7917 if(HVRange.first == HVRange.second)
7924 HVIt1 = HVRange.first;
7929 if(--HVRange.second != HVRange.first)
7931 HVIt2 = HVRange.second;
7935 HVIt2->second).
SpeedTag == SpeedTag)))
7955 AnsiString(SpeedTag));
8021 AnsiString TestString1, TestString2;
8026 throw Exception(
"LNPendingList size not 1 on entry");
8028 int CurrentElementNumber;
8034 int H = CurrentElement->HLoc;
8035 int V = CurrentElement->VLoc;
8036 int Tag = CurrentElement->SpeedTag;
8042 for(
int x = 0; x < 25; x++)
8052 for(
int x = 0; x < 25; x++)
8062 for(
int x = 0; x < 25; x++)
8072 for(
int x = 0; x < 25; x++)
8082 for(
int x = 0; x < 28; x++)
8092 for(
int x = 0; x < 8; x++)
8102 for(
int x = 0; x < 8; x++)
8112 for(
int x = 0; x < 4; x++)
8122 for(
int x = 0; x < 8; x++)
8132 for(
int x = 0; x < 8; x++)
8145 if(CurrentElementNumber > -1)
8150 if((ExistingName !=
"") && (ExistingName != LocationName))
8166 AddName(1, CurrentElement, LocationName);
8170 LNDone2MultiMapEntry.first = HVPair;
8181 bool FoundFlag, ErasedFlag =
false;
8183 if(SNRange.first != SNRange.second)
8187 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8194 TVIt->LocationName =
"";
8195 TVIt->ActiveTrackElementName =
"";
8228 std::pair<AnsiString, char>TempMapPair;
8236 TempMapPair.second =
'x';
8254 AnsiString(SpeedTag));
8264 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8271 int MapPos = -1 - Position;
8275 FoundElement = MapPos;
8291 FoundElement = IMPair.first;
8300 FoundElement = IMPair.second;
8321 AnsiString OldName = TrackElement->LocationName, ErrorString;
8323 TrackElement->LocationName = Name;
8324 int HLoc = TrackElement->HLoc;
8325 int VLoc = TrackElement->VLoc;
8339 if(ErrorString !=
"")
8341 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8365 if(LNDone2MultiMapIterator->second == MapPos)
8392 if(*LNPendingListIterator == MapPos)
8465 if(NameBeingChecked !=
"")
8471 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8479 NameBeingChecked = LNMMRg.second->first;
8481 if(NameBeingChecked !=
"")
8487 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8508 if(LNMMIt->second < 0)
8518 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8526 std::list<THVPair> HVLinkedList;
8529 HVPairsLinkedMap.begin()->second =
true;
8530 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8533 THVPair HVPairUnderExamination;
8534 THVPairsLinkedMap::iterator HVPLMIt;
8536 while(!HVLinkedList.empty())
8538 HVPairUnderExamination = HVLinkedList.front();
8539 HVLinkedList.pop_front();
8540 HVPairNew.first = HVPairUnderExamination.first;
8541 HVPairNew.second = HVPairUnderExamination.second - 1;
8542 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8543 if(HVPLMIt != HVPairsLinkedMap.end())
8545 if(!HVPLMIt->second)
8547 HVLinkedList.push_back(HVPLMIt->first);
8549 HVPLMIt->second =
true;
8551 HVPairNew.first = HVPairUnderExamination.first - 1;
8552 HVPairNew.second = HVPairUnderExamination.second;
8553 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8554 if(HVPLMIt != HVPairsLinkedMap.end())
8556 if(!HVPLMIt->second)
8558 HVLinkedList.push_back(HVPLMIt->first);
8560 HVPLMIt->second =
true;
8562 HVPairNew.first = HVPairUnderExamination.first;
8563 HVPairNew.second = HVPairUnderExamination.second + 1;
8564 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8565 if(HVPLMIt != HVPairsLinkedMap.end())
8567 if(!HVPLMIt->second)
8569 HVLinkedList.push_back(HVPLMIt->first);
8571 HVPLMIt->second =
true;
8573 HVPairNew.first = HVPairUnderExamination.first + 1;
8574 HVPairNew.second = HVPairUnderExamination.second;
8575 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8576 if(HVPLMIt != HVPairsLinkedMap.end())
8578 if(!HVPLMIt->second)
8580 HVLinkedList.push_back(HVPLMIt->first);
8582 HVPLMIt->second =
true;
8587 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
8589 if(!HVPLMIt->second)
8608 if(LocationName ==
"")
8619 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8625 ActiveTrackElementNameMapEntry.first =
Track->
TrackVector.at(x).ActiveTrackElementName;
8626 ActiveTrackElementNameMapEntry.second = 0;
8648 bool FoundFlag, ErasedFlag =
false;
8652 if(SNRange.first != SNRange.second)
8655 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
8658 TVIt->LocationName =
"";
8659 TVIt->ActiveTrackElementName =
"";
8693 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
8695 AnsiString LocationName;
8704 if(LocationName !=
"")
8712 if(LocationName !=
"")
8726 if(LocationName !=
"")
8728 int ModifiedPosition = -1 - Position;
8737 for(
int x = 0; x < 25; x++)
8747 else if(SpeedTag == 77)
8749 for(
int x = 0; x < 25; x++)
8759 else if(SpeedTag == 78)
8761 for(
int x = 0; x < 25; x++)
8771 else if(SpeedTag == 79)
8773 for(
int x = 0; x < 25; x++)
8783 else if(SpeedTag == 96)
8785 for(
int x = 0; x < 28; x++)
8795 else if(SpeedTag == 129)
8797 for(
int x = 0; x < 8; x++)
8807 else if(SpeedTag == 130)
8809 for(
int x = 0; x < 8; x++)
8819 else if(SpeedTag == 145)
8821 for(
int x = 0; x < 8; x++)
8831 else if(SpeedTag == 146)
8833 for(
int x = 0; x < 8; x++)
8843 else if(SpeedTag == 131)
8845 for(
int x = 0; x < 4; x++)
8868 AnsiString(SpeedTag));
8880 if(TempElement->LocationName !=
"")
8882 LocationName = TempElement->LocationName;
8883 FoundElement = IMPair.first;
8891 if(TempElement->LocationName !=
"")
8893 LocationName = TempElement->LocationName;
8894 FoundElement = IMPair.second;
8906 if(TempElement->LocationName !=
"")
8908 LocationName = TempElement->LocationName;
8909 FoundElement = -1 - Position;
8925 unsigned int Count = 0;
8932 AnsiString SName, TName, ErrorString;
8934 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8940 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
8941 AnsiString(Caller));
8954 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
8955 AnsiString(Caller));
8962 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
8963 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
8968 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
8974 if(ErrorString !=
"")
8976 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
8978 if(SNIt->second != -1 - (
int)x)
8980 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
8981 AnsiString(Caller));
8987 bool FoundFlag =
false;
8996 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
8997 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9001 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackVector.at(x).HLoc) +
9002 " & V " + AnsiString(
TrackVector.at(x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9003 AnsiString(Caller));
9008 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackVector.at(x).HLoc) +
" & V " +
9009 AnsiString(
TrackVector.at(x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9019 if(ErrorString !=
"")
9021 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9023 if(SNIt->second != (
int)x)
9025 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9026 AnsiString(Caller));
9036 AnsiString &ErrorString)
9044 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9046 bool FoundFlag =
false;
9050 if(SNRange.first == SNRange.second)
9052 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9054 return(SNRange.first);
9058 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9060 if(SNIterator->second < 0)
9062 int TVPos = -1 - SNIterator->second;
9064 if(TVIt == TrackElement)
9073 int ITVPos = SNIterator->second;
9075 if(ITVIt == TrackElement)
9086 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9103 LocationNameEntry.first = NewName;
9104 LocationNameEntry.second = SNIterator->second;
9118 int TruePos = -1 - Position;
9122 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9132 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9155 InactiveTrack2MultiMapIterator++)
9157 if(InactiveTrack2MultiMapIterator->second > VecPos)
9159 InactiveTrack2MultiMapIterator->second--;
9167 LocationNameMultiMapIterator++)
9169 if(LocationNameMultiMapIterator->second < 0)
9173 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9175 LocationNameMultiMapIterator->second--;
9197 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9199 if(TrackMapIterator->second > VecPos)
9201 TrackMapIterator->second--;
9209 LocationNameMultiMapIterator++)
9211 if(LocationNameMultiMapIterator->second >= 0)
9217 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9219 LocationNameMultiMapIterator->second++;
9223 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9229 if(TkEl.
Conn[0] ==
int(VecPos))
9234 if(TkEl.
Conn[0] >
int(VecPos))
9238 if(TkEl.
Conn[0] > -1)
9264 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9270 LocationNameEntry.second = -1 - TVPos;
9281 LocationNameEntry.second = ITVPos;
9323 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9355 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9383 AnsiString((
short)FirstTrack));
9384 bool LengthDifferent =
false, SpeedDifferent =
false;
9391 int EXArray[16][2] =
9393 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9394 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9397 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9398 Graphics::TBitmap *Bitmap;
9402 InLink = TrackElement.
Link[0];
9403 OutLink = TrackElement.
Link[1];
9407 InLink = TrackElement.
Link[2];
9408 OutLink = TrackElement.
Link[3];
9410 for(
int x = 0; x < 16; x++)
9412 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9419 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9438 else if(TrackElement.
SpeedTag == 54)
9442 else if(TrackElement.
SpeedTag == 55)
9453 else if(TrackElement.
SpeedTag == 58)
9457 else if(TrackElement.
SpeedTag == 59)
9462 else if(Index == 14)
9468 else if(TrackElement.
SpeedTag == 52)
9472 else if(TrackElement.
SpeedTag == 57)
9477 else if(Index == 15)
9483 else if(TrackElement.
SpeedTag == 53)
9487 else if(TrackElement.
SpeedTag == 56)
9501 if(LengthDifferent && SpeedDifferent)
9569 else if(LengthDifferent && !SpeedDifferent)
9716 AnsiString((
short)FirstTrack));
9717 LengthDifferent =
false;
9718 SpeedDifferent =
false;
9723 LengthDifferent =
true;
9727 SpeedDifferent =
true;
9729 if(LengthDifferent || SpeedDifferent)
9742 LengthDifferent =
true;
9746 SpeedDifferent =
true;
9748 if(LengthDifferent || SpeedDifferent)
9761 LengthDifferent =
true;
9765 SpeedDifferent =
true;
9767 if(LengthDifferent || SpeedDifferent)
9847 AnsiString TempName;
9848 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
9849 bool ForwardSet, ReverseSet;
9851 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9856 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9894 for(
int y = 0; y < 2; y++)
9925 StartElement = TempElement;
9926 StartVecPos = VecPos;
9930 StartEntryPos = 1 - Dir;
9939 VecPos = TempElement.
Conn[1 - EntryPos];
9940 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
9942 EntryPos = TempEntryPos;
9970 ForwardNumber = ((Count + 1) / 2) + 1;
9971 ReverseNumber = (Count - ForwardNumber) + 1;
9974 TempElement = StartElement;
9975 VecPos = StartVecPos;
9976 if(Count == ForwardNumber)
9981 if(Count == ReverseNumber)
9989 VecPos = TempElement.
Conn[1 - EntryPos];
9990 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
9992 EntryPos = TempEntryPos;
9994 if(Count == ForwardNumber)
9999 if(Count == ReverseNumber)
10011 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10013 if(
TrackVector.at(x).StationEntryStopLinkPos1 == 5)
10017 if(
TrackVector.at(x).StationEntryStopLinkPos2 == 5)
10147 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10203 if((TextH / 16) - 1 <
HLocMin)
10207 if((TextH / 16) + 1 >
HLocMax)
10211 if((TextV / 16) - 1 <
VLocMin)
10215 if((TextV / 16) + 1 >
VLocMax)
10245 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10246 bool &UserGraphicFoundFlag)
10249 TUserGraphicVector::iterator UserGraphicPtr;
10251 UserGraphicFoundFlag =
false;
10258 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10259 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10261 UserGraphicItem = x;
10262 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10263 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10264 UserGraphicFoundFlag =
true;
10282 int SpeedTag = TrackElement.
SpeedTag;
10286 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10335 return(GraphicOutput);
10343 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10346 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10359 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10360 " in InactiveTrackElementAt");
10371 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10373 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10398 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10399 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10403 if(SNRange.first == SNRange.second)
10408 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10410 if(SNIterator->second < 0)
10420 HVPair.first = InactiveElement.
HLoc;
10421 HVPair.second = InactiveElement.
VLoc;
10425 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNamedLocationLongEnoughForSplit (1)");
10427 int TVPos =
TrackMap.find(HVPair)->second;
10430 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10436 FirstNamedExitPos = 0;
10438 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
10440 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10441 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10444 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10446 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
10447 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10448 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10451 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10461 FirstNamedExitPos = 1;
10463 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
10465 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10466 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10469 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10471 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
10472 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10473 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10476 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10492 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
10506 AnsiString(FirstNamedElementPos));
10507 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10508 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10510 SecondNamedElementPos = -1;
10511 FirstNamedLinkedElementPos = -1;
10512 SecondNamedLinkedElementPos = -1;
10516 if(SNRange.first == SNRange.second)
10521 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10523 if(SNIterator->second < 0)
10533 HVPair.first = InactiveElement.
HLoc;
10534 HVPair.second = InactiveElement.
VLoc;
10546 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisNamedLocationLongEnoughForSplit (2)"
10550 int TVPos =
TrackMap.find(HVPair)->second;
10551 if(TVPos != FirstNamedElementPos)
10557 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10563 FirstNamedExitPos = 0;
10565 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
10567 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10568 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10571 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10573 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
10574 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10575 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10578 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10580 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10581 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10582 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10591 FirstNamedExitPos = 1;
10593 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
10595 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
10596 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
10599 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
10601 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
10602 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
10603 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
10606 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
10608 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
10609 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
10610 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
10631 if(SNRange.first != SNRange.second)
10633 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10635 if(SNIterator->second < 0)
10657 "," + AnsiString(SpeedTag));
10668 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
10698 else if(SpeedTag == 69)
10724 else if(SpeedTag == 70)
10750 else if(SpeedTag == 71)
10787 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
10788 if(NextEntryPos < 0)
10801 if(NextEntryPos > 1)
10820 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
10832 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
10833 bool FoundFlag =
false;
10848 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
10849 bool FoundFlag =
false;
10874 VPosHi = 16 * VLocHi;
10875 VPosLo = 16 * VLocLo;
10894 AnsiString(EndTVPosition));
10905 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
10906 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
10907 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
10908 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
10910 if(Link0Squares <= Link1Squares)
10928 AnsiString(LinkPos));
10947 if((LinkPos == 1) && (TE.
Attribute == 0))
10952 else if(LinkPos == 1)
10958 else if((LinkPos == 3) && (TE.
Attribute == 1))
10963 else if(LinkPos == 3)
10970 else if(LinkPos == 0)
10975 else if(LinkPos == 1)
10980 else if(LinkPos == 2)
10985 else if(LinkPos == 3)
10990 throw Exception(
"Error, failure in GetExitPos");
11039 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
11043 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11085 "," + AnsiString(DiagonalLinkNumber));
11090 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
11095 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
11100 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
11105 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
11121 AnsiString JustFileName =
"";
11126 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
11133 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
11152 typedef std::list<int> TNamePosList;
11153 TNamePosList NamePosList;
11154 typedef TNamePosList::iterator TNPLIt;
11156 typedef std::list<int> TOnePlatList;
11157 TOnePlatList OnePlatList;
11158 typedef TOnePlatList::iterator TOPLIt;
11161 NamePosList.clear();
11162 OnePlatList.clear();
11163 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
11165 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
11167 NamePosList.push_back(x);
11172 if(!NamePosList.empty())
11174 OnePlatList.push_back(NamePosList.back());
11175 NamePosList.pop_back();
11177 while(!OnePlatList.empty())
11179 TempInt = OnePlatList.front();
11182 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
11183 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
11185 OnePlatList.push_back(TempElement.
Conn[0]);
11186 NamePosList.erase(NPLIt);
11188 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
11189 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
11191 OnePlatList.push_back(TempElement.
Conn[1]);
11192 NamePosList.erase(NPLIt);
11195 OnePlatList.erase(OnePlatList.begin());
11196 if(OnePlatList.empty())
11199 if(!NamePosList.empty())
11201 OnePlatList.push_back(NamePosList.back());
11202 NamePosList.pop_back();
11219 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
11234 throw Exception(
"Return value negative in call to LastElementNumber");
11246 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
11260 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
11272 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
11273 " in GetModifiablePrefDirElementAt");
11283 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11285 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
11295 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
11297 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
11314 int TrackVectorPosition;
11366 FinishElement =
false;
11367 int TrackVectorPosition;
11389 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
11399 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
11422 for(
int x = 0; x < 4; x++)
11445 FinishElement =
true;
11453 for(
int x = 0; x < 4; x++)
11465 FinishElement =
true;
11473 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11480 .ELinkPos] ==
Lead))
11496 FinishElement =
true;
11515 FinishElement =
true;
11534 FinishElement =
true;
11549 FinishElement =
true;
11558 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11574 FinishElement =
true;
11580 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
11603 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
11604 int VectorCount = 0;
11608 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
11610 for(
int x = 0; x < VectorCount; x++)
11617 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
11621 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
11622 SearchElement.
ELinkPos = NextELinkPos;
11643 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
11645 SearchElement.
XLinkPos = NextXLinkPos;
11671 for(
int x = 0; x < VectorCount; x++)
11683 for(
int x = 0; x < VectorCount; x++)
11697 for(
int x = 0; x < VectorCount; x++)
11711 for(
int x = 0; x < VectorCount; x++)
11721 for(
int x = 0; x < VectorCount; x++)
11732 SearchElement.
XLink = SearchElement.
Link[1];
11751 SearchElement.
XLink = SearchElement.
Link[3];
11764 for(
int x = 0; x < VectorCount; x++)
11779 XLinkPos = NextXLinkPos;
11780 CurrentTrackElement = SearchElement;
11799 throw Exception(
"Error, SearchVector empty");
11806 for(
int x = 0; x < 4; x++)
11859 throw Exception(
"Error in EntryExitNumber 1");
11878 if(PrefDirElement.
XLink == -1)
11890 if(PrefDirElement.
XLink != -1)
11894 throw Exception(
"Error in EntryExitNumber 2");
11932 LeadingPoints =
false;
11960 LeadingPoints =
true;
11976 AnsiString ErrorString;
11977 bool Error =
false;
11984 ErrorString =
"HLoc";
11990 ErrorString =
"VLoc";
11996 ErrorString =
"ELink";
12002 ErrorString =
"ELinkPos";
12008 ErrorString =
"XLink";
12014 ErrorString =
"XLinkPos";
12020 ErrorString =
"Tag";
12026 ErrorString =
"TrackVectorPosition";
12032 ErrorString =
"EXNumber";
12039 ErrorString =
"CheckCount";
12046 ErrorString =
"EntryGraphicPtr";
12052 ErrorString =
"EntryDirectionGraphicPtr";
12061 ErrorString =
"Last XLink not connected to this element";
12068 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
12092 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
12149 AnsiString((
short)BuildingPrefDir));
12152 if(PrefDirSize() == 0)
12157 for(
unsigned int x = 0; x < PrefDirSize(); x++)
12169 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
12181 if(x == (PrefDirSize() - 1))
12190 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
12192 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
12193 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
12194 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
12196 if(PrefDirSize() > 1)
12198 unsigned int LatestPos = PrefDirSize() - 1;
12199 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
12200 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
12201 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
12222 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12225 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
12229 H = MMIT->first.first;
12230 V = MMIT->first.second;
12233 if(PrefDirPos0 > -1)
12237 if(PrefDirPos1 > -1)
12241 if(PrefDirPos2 > -1)
12245 if(PrefDirPos3 > -1)
12249 if(PrefDirPos3 > -1)
12265 else if(PrefDirPos2 > -1)
12307 else if(PrefDirPos1 > -1)
12330 else if(PrefDirPos0 > -1)
12349 int NumberOfPrefDirElements = 0;
12352 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12354 VecFile >> TempInt;
12357 VecFile >> TempInt;
12358 LoadPrefDirElement.
ELink = TempInt;
12359 VecFile >> TempInt;
12360 LoadPrefDirElement.
ELinkPos = TempInt;
12361 VecFile >> TempInt;
12362 LoadPrefDirElement.
XLink = TempInt;
12363 VecFile >> TempInt;
12364 LoadPrefDirElement.
XLinkPos = TempInt;
12365 VecFile >> TempInt;
12366 LoadPrefDirElement.
EXNumber = TempInt;
12367 VecFile >> TempInt;
12372 if(!(LoadPrefDirElement.
IsARoute))
12398 int NumberOfPrefDirElements = 0;
12401 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12403 VecFile >> TempInt;
12404 VecFile >> TempInt;
12407 VecFile >> TempInt;
12408 LoadPrefDirElement.
ELink = TempInt;
12409 VecFile >> TempInt;
12410 LoadPrefDirElement.
ELinkPos = TempInt;
12411 VecFile >> TempInt;
12412 LoadPrefDirElement.
XLink = TempInt;
12413 VecFile >> TempInt;
12414 LoadPrefDirElement.
XLinkPos = TempInt;
12415 VecFile >> TempInt;
12416 LoadPrefDirElement.
EXNumber = TempInt;
12417 VecFile >> TempInt;
12422 if(!(LoadPrefDirElement.
IsARoute))
12450 int NumberOfPrefDirElements = 0;
12453 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
12458 for(
int x = 0; x < NumberOfPrefDirElements; x++)
12465 VecFile >> TempInt;
12466 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
12471 VecFile >> TempInt;
12472 if((TempInt < -1) || (TempInt > 9))
12477 VecFile >> TempInt;
12478 if((TempInt < -1) || (TempInt > 3))
12483 VecFile >> TempInt;
12484 if((TempInt < -1) || (TempInt > 9))
12489 VecFile >> TempInt;
12490 if((TempInt < -1) || (TempInt > 3))
12495 VecFile >> TempInt;
12496 if((TempInt < -1) || (TempInt > 27))
12501 VecFile >> TempInt;
12509 VecFile >> TempInt;
12510 if((TempInt != 0) && (TempInt != 1))
12515 VecFile >> TempInt;
12516 if((TempInt != 0) && (TempInt != 1))
12521 VecFile >> TempInt;
12522 if((TempInt != 0) && (TempInt != 1))
12545 for(
int y = 0; y < NumberOfPrefDirElements; y++)
12547 VecFile << y <<
'\n';
12548 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
12558 if(y == (NumberOfPrefDirElements - 1))
12560 VecFile <<
"************" <<
'\0' <<
'\n';
12564 VecFile <<
"******" <<
'\0' <<
'\n';
12578 for(
int y = 0; y < NumberOfSearchElements; y++)
12580 VecFile << y <<
'\n';
12581 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
12591 if(y == (NumberOfSearchElements - 1))
12593 VecFile <<
"************" <<
'\0' <<
'\n';
12597 VecFile <<
"******" <<
'\0' <<
'\n';
12710 bool AlreadyPresent, FoundFlag;
12711 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
12713 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
12717 AlreadyPresent =
false;
12722 AlreadyPresent =
true;
12726 AlreadyPresent =
true;
12730 AlreadyPresent =
true;
12734 AlreadyPresent =
true;
12737 if(!AlreadyPresent)
12784 for(
unsigned int z = 0; z < 4; z++)
12792 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
12806 bool DiscrepancyFound =
false;
12817 DiscrepancyFound =
true;
12822 DiscrepancyFound =
true;
12827 DiscrepancyFound =
true;
12832 DiscrepancyFound =
true;
12837 DiscrepancyFound =
true;
12843 DiscrepancyFound =
true;
12846 if(DiscrepancyFound)
12848 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
12863 bool DiscrepancyFound =
false;
12874 DiscrepancyFound =
true;
12878 DiscrepancyFound =
true;
12883 DiscrepancyFound =
true;
12888 DiscrepancyFound =
true;
12893 DiscrepancyFound =
true;
12899 DiscrepancyFound =
true;
12903 return(!DiscrepancyFound);
12915 bool FoundFlag =
false;
12916 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
12924 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
12925 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
12927 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
12929 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
12930 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
12931 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
12936 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
12937 +
" Caller=" + (AnsiString)Caller);
12963 PrefDirMapKeyPair.first = HLoc;
12964 PrefDirMapKeyPair.second = VLoc;
12965 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
12968 if(ItPair.first == ItPair.second)
12976 PrefDirPos0 = ItPair.first->second;
12978 if(ItPair.first == ItPair.second)
12983 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
12985 PrefDirPos1 = ItPair.first->second;
12988 if(ItPair.first == ItPair.second)
12993 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
12995 PrefDirPos2 = ItPair.first->second;
12998 if(ItPair.first == ItPair.second)
13003 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
13005 PrefDirPos3 = ItPair.first->second;
13019 +
"," + AnsiString(LinkNumberPos));
13021 int PD0, PD1, PD2, PD3;
13022 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
13026 PD0, PD1, PD2, PD3);
13038 LinkedPrefDirVectorNumber = PD0;
13047 LinkedPrefDirVectorNumber = PD1;
13057 LinkedPrefDirVectorNumber = PD0;
13066 LinkedPrefDirVectorNumber = PD1;
13075 LinkedPrefDirVectorNumber = PD2;
13084 LinkedPrefDirVectorNumber = PD3;
13089 LinkedPrefDirVectorNumber = -1;
13095 LinkedPrefDirVectorNumber = -1;
13100 catch(
const Exception &e)
13102 LinkedPrefDirVectorNumber = -1;
13114 int PD0, PD1, PD2, PD3;
13166 THVPair PrefDir4MultiMapKeyPair;
13169 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
13170 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
13171 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
13194 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
13213 AnsiString(ErasedElementNumber));
13218 if(MapPtr->second > ErasedElementNumber)
13240 throw Exception(
"PrefDirVectorPosition out of range");
13243 THVPair PrefDir4MultiMapKeyPair;
13245 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
13246 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
13247 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13250 if(ItPair.first == ItPair.second)
13253 return(ItPair.first);
13257 if(ItPair.first->second == PrefDirVectorPosition)
13261 return(ItPair.first);
13264 if(ItPair.first == ItPair.second)
13267 return(ItPair.first);
13269 if(ItPair.first->second == PrefDirVectorPosition)
13273 return(ItPair.first);
13276 if(ItPair.first == ItPair.second)
13279 return(ItPair.first);
13281 if(ItPair.first->second == PrefDirVectorPosition)
13285 return(ItPair.first);
13288 if(ItPair.first == ItPair.second)
13291 return(ItPair.first);
13293 if(ItPair.first->second == PrefDirVectorPosition)
13297 return(ItPair.first);
13301 return(ItPair.first);
13314 THVPair PrefDir4MultiMapKeyPair;
13316 PrefDir4MultiMapKeyPair.first = HLoc;
13317 PrefDir4MultiMapKeyPair.second = VLoc;
13318 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13321 if(ItPair.first == ItPair.second)
13329 return(ItPair.first->second);
13338 bool ErasedFlag =
false;
13340 if(ErasedTrackVectorPosition > -1)
13349 ErasedFlag =
false;
13351 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
13356 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
13361 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
13366 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
13371 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
13379 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
13383 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
13387 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
13391 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
13395 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
13410 OverallDistance = 0;
13411 OverallSpeedLimit = 0;
13412 LeadingPointsAtLastElement =
false;
13420 LeadingPointsAtLastElement =
true;
13429 OverallDistance += PrefDirElement.
Length23;
13430 if(OverallSpeedLimit != -1)
13440 OverallSpeedLimit = -1;
13447 OverallDistance += PrefDirElement.
Length01;
13448 if(OverallSpeedLimit != -1)
13458 OverallSpeedLimit = -1;
13477 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13480 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13484 HLoc = MMIT->first.first;
13485 VLoc = MMIT->first.second;
13490 if(PrefDirPos0 > -1)
13494 if(PrefDirPos1 > -1)
13498 if(PrefDirPos2 > -1)
13502 if(PrefDirPos3 > -1)
13506 if(PrefDirPos3 > -1)
13509 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13511 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13513 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13515 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
13522 else if(PrefDirPos2 > -1)
13527 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13529 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13531 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
13540 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13542 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13544 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13553 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13555 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
13557 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13564 else if(PrefDirPos1 > -1)
13569 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
13571 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
13579 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13581 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
13587 else if(PrefDirPos0 > -1)
13589 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
13606 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13609 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13630 if(PrefDirPos0 > -1)
13634 if(PrefDirPos1 > -1)
13638 if(PrefDirPos2 > -1)
13642 if(PrefDirPos3 > -1)
13646 if(PrefDirPos3 > -1)
13651 else if(PrefDirPos2 > -1)
13653 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
13664 else if(PrefDirPos1 > -1)
13666 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
13677 else if(PrefDirPos0 > -1)
13679 if(PrefDirElement0.
XLinkPos == EntryPos)
13716 ElementIn.
VLoc +
"," + XLink);
13718 bool TrackFoundFlag;
13721 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
13733 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
13743 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13757 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13767 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13781 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
13791 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
13805 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
13815 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
13838 bool FoundFlag, ContFlag, FoundElements =
false;
13839 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13844 LastIteratorValue++;
13869 if(PDVIt->XLinkPos == 0)
13874 StartElement = *PDVIt;
13883 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
13885 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
13886 if(PrefDirPos0 == -1)
13890 bool NextElementFoundFlag =
false;
13894 NextElementFoundFlag =
true;
13896 if(PrefDirPos1 > -1)
13901 NextElementFoundFlag =
true;
13904 if(PrefDirPos2 > -1)
13909 NextElementFoundFlag =
true;
13912 if(PrefDirPos3 > -1)
13917 NextElementFoundFlag =
true;
13920 if(!NextElementFoundFlag)
13950 EndElement = NextElement;
13954 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
13956 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
13957 if(PrefDirPos0 == -1)
13967 if(PrefDirPos1 > -1)
13975 if(PrefDirPos2 > -1)
13983 if(PrefDirPos3 > -1)
14014 FoundElements =
true;
14048 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
14050 int TrackVectorPosition;
14086 int LockedVectorNumber;
14109 bool InPrefDirFlag =
false;
14112 int PrefDirPos0 = -1;
14113 int PrefDirPos1 = -1;
14114 int PrefDirPos2 = -1;
14115 int PrefDirPos3 = -1;
14119 int PrefDirVecPos[4] =
14121 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14124 for(
int x = 0; x < 4; x++)
14126 int b = PrefDirVecPos[x];
14136 InPrefDirFlag =
true;
14150 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14158 if(DummyPair.first > -1)
14160 throw Exception(
"Selection in two routes - should never happen!");
14162 if(RoutePair.first > -1)
14238 IDInt &ReqPosRouteID,
bool &PointsChanged)
14272 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
14322 bool InPrefDirFlag =
false;
14325 int PrefDirPos0 = -1;
14326 int PrefDirPos1 = -1;
14327 int PrefDirPos2 = -1;
14328 int PrefDirPos3 = -1;
14331 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
14332 int PrefDirVecPos[4] =
14334 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14337 for(
int x = 0; x < 4; x++)
14339 int b = PrefDirVecPos[x];
14342 InPrefDirFlag =
true;
14356 "Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
14365 if(RoutePair.first > -1)
14367 if(RoutePair.second != 0)
14384 EndElement1 = RouteElement;
14385 EndElement2 = BlankElement;
14485 PointsChanged =
true;
14513 PointsChanged =
true;
14536 PointsChanged =
true;
14565 PointsChanged =
true;
14579 PointsChanged =
true;
14598 PointsChanged =
true;
14612 PointsChanged =
true;
14628 PointsChanged =
true;
14682 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag)
14735 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
14736 AnsiString((
short)AutoSigsFlag));
14737 int VectorCount = 0;
14741 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
14745 for(
int x = 0; x < VectorCount; x++)
14753 bool FirstPass =
true;
14763 for(
int x = 0; x < VectorCount; x++)
14772 for(
int x = 0; x < VectorCount; x++)
14784 for(
int x = 0; x < VectorCount; x++)
14792 int NextPosition = PrefDirElement.
Conn[XLinkPos];
14796 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
14797 SearchElement.
ELinkPos = NextELinkPos;
14798 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
14819 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
14821 SearchElement.
XLinkPos = NextXLinkPos;
14833 for(
int x = 0; x < VectorCount; x++)
14847 if(RoutePair.first > -1)
14856 for(
int x = 0; x < VectorCount; x++)
14865 if(SecondPair.first > -1)
14874 for(
int x = 0; x < VectorCount; x++)
14888 for(
int x = 0; x < VectorCount; x++)
14899 for(
int x = 0; x < VectorCount; x++)
14908 for(
int x = 0; x < VectorCount; x++)
14917 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
14921 for(
int x = 0; x < VectorCount; x++)
14931 bool InPrefDirFlag =
false;
14932 PrefDirElement1 = BlankElement;
14933 PrefDirElement2 = BlankElement;
14936 int PrefDirPos0 = -1;
14937 int PrefDirPos1 = -1;
14938 int PrefDirPos2 = -1;
14939 int PrefDirPos3 = -1;
14942 int PrefDirVecPos[4] =
14944 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
14946 for(
int x = 0; x < 4; x++)
14948 int b = PrefDirVecPos[x];
14951 InPrefDirFlag =
true;
14964 for(
int x = 0; x < VectorCount; x++)
14976 for(
int x = 0; x < VectorCount; x++)
14992 for(
int x = 0; x < VectorCount; x++)
15012 for(
int x = 0; x < VectorCount; x++)
15029 for(
int x = 0; x < VectorCount; x++)
15039 for(
int x = 0; x < VectorCount; x++)
15050 int SearchPos1 = SearchElement.
Attribute + 1;
15052 if(SearchPos1 == 2)
15056 if(SearchPos1 == 1)
15064 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
15065 SearchElement.
XLinkPos = SearchPos1;
15066 InPrefDirFlag =
false;
15067 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15069 SearchElement = PrefDirElement1;
15070 InPrefDirFlag =
true;
15072 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15074 SearchElement = PrefDirElement2;
15075 InPrefDirFlag =
true;
15081 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15085 for(
int x = 0; x < VectorCount; x++)
15112 for(
int x = 0; x < VectorCount; x++)
15130 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
15131 SearchElement.
XLinkPos = SearchPos2;
15132 if(SearchElement.
XLink == PrefDirElement1.
XLink)
15134 SearchElement = PrefDirElement1;
15136 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
15138 SearchElement = PrefDirElement2;
15142 for(
int x = 0; x < VectorCount; x++)
15150 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
15154 for(
int x = 0; x < VectorCount; x++)
15182 for(
int x = 0; x < VectorCount; x++)
15194 for(
int x = 0; x < VectorCount; x++)
15204 SearchElement = PrefDirElement1;
15213 XLinkPos = SearchElement.
XLinkPos;
15214 PrefDirElement = SearchElement;
15271 unsigned int TruncatePrefDirPosition = 0;
15344 throw Exception(
"Error - failed to validate extended route for preferred route");
15399 throw Exception(
"Error - failed to validate single route for preferred route");
15444 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
15446 int TrackVectorPosition;
15483 int LockedVectorNumber;
15517 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
15518 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
15521 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
15527 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
15528 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
15531 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
15545 if(RoutePair.first > -1)
15743 EndElement1.
ELink = EndElement1.
Link[0];
15744 EndElement1.
XLink = EndElement1.
Link[1];
15747 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
15752 EndElement2.
ELink = EndElement2.
Link[1];
15753 EndElement2.
XLink = EndElement2.
Link[0];
15756 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
15800 if(RoutePair.first > -1)
15802 if(RoutePair.second != 0)
15825 EndElement2 = BlankElement;
15910 PointsChanged =
true;
15936 PointsChanged =
true;
15958 PointsChanged =
true;
15984 PointsChanged =
true;
15998 PointsChanged =
true;
16038 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
16039 int VectorCount = 0;
16042 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
16043 (CurrentTrackElement.
Link[XLinkPos] == 9))
16047 for(
int x = 0; x < VectorCount; x++)
16059 for(
int x = 0; x < VectorCount; x++)
16066 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
16068 for(
int x = 0; x < VectorCount; x++)
16075 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
16079 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
16080 SearchElement.
ELinkPos = NextELinkPos;
16101 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16103 SearchElement.
XLinkPos = NextXLinkPos;
16116 for(
int x = 0; x < VectorCount; x++)
16130 if(RoutePair.first > -1)
16139 for(
int x = 0; x < VectorCount; x++)
16148 if(SecondPair.first > -1)
16157 for(
int x = 0; x < VectorCount; x++)
16171 for(
int x = 0; x < VectorCount; x++)
16182 for(
int x = 0; x < VectorCount; x++)
16191 for(
int x = 0; x < VectorCount; x++)
16200 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16204 for(
int x = 0; x < VectorCount; x++)
16217 for(
int x = 0; x < VectorCount; x++)
16249 for(
int x = 0; x < VectorCount; x++)
16259 for(
int x = 0; x < VectorCount; x++)
16270 int SearchPos1 = SearchElement.
Attribute + 1;
16272 if(SearchPos1 == 2)
16276 if(SearchPos1 == 1)
16285 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16286 SearchElement.
XLinkPos = SearchPos1;
16288 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16292 for(
int x = 0; x < VectorCount; x++)
16317 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16318 SearchElement.
XLinkPos = SearchPos2;
16320 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16324 for(
int x = 0; x < VectorCount; x++)
16343 for(
int x = 0; x < VectorCount; x++)
16358 CurrentTrackElement = SearchElement;
16359 XLinkPos = SearchElement.
XLinkPos;
16381 throw Exception(
"Error, SearchVector empty");
16393 for(
int x = 0; x < 4; x++)
16435 throw Exception(
"Error in EntryExitNumber 3");
16490 unsigned int TruncatePrefDirPosition = 0;
16550 throw Exception(
"Failed to validate extended route for nonpreferred route");
16595 throw Exception(
"Failed to validate single route for nonpreferred route");
16615 if(!PrefDirVector.empty())
16619 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
16624 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
16659 if(!PrefDirVector.empty())
16662 TPrefDirElement LastElement = GetFixedPrefDirElementAt(185, PrefDirSize() - 1);
16664 int ForwardLinkedRouteNumber, Attribute = 0;
16671 if(ForwardLinkedRouteNumber > -1)
16673 int NextForwardLinkedRouteNumber = -1;
16677 ForwardLinkedRouteNumber = NextForwardLinkedRouteNumber;
16687 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
16707 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
16715 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
16746 NextForwardLinkedRouteNumber = -1;
16747 for(
unsigned int x = 0; x < PrefDirSize(); x++)
16749 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
16750 if(PrefDirVector.at(x).TrackType ==
Bridge)
16752 if(PrefDirVector.at(x).XLinkPos < 2)
16754 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos01;
16758 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeTrackPos23;
16766 if(PrefDirVector.at(x).TrackType ==
Buffers)
16778 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
16787 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
16789 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute + 1;
16797 if(x == PrefDirSize() - 1)
16839 AnsiString(PrefDirVectorStartPosition));
16844 bool SkipContinuationAndBufferAttributeChange =
false;
16846 if(!PrefDirVector.empty())
16848 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
16851 if(PrefDirPtr->TrackType ==
Bridge)
16853 if(PrefDirPtr->XLinkPos < 2)
16864 SkipContinuationAndBufferAttributeChange =
true;
16879 SkipContinuationAndBufferAttributeChange =
true;
16887 SkipContinuationAndBufferAttributeChange =
true;
16889 if(!SkipContinuationAndBufferAttributeChange)
16891 if(PrefDirVector.back().TrackType ==
Buffers)
16900 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
16903 if(PrefDirPtr->TrackType ==
Bridge)
16905 if(PrefDirPtr->XLinkPos < 2)
16921 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
16930 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
16932 if((!
AllRoutes->
RouteTruncateFlag) || (PrefDirPtr != (PrefDirVector.begin() + PrefDirVectorStartPosition)) || PrefDirPtr->AutoSignals ||
16933 PrefDirPtr->PrefDirRoute)
16980 "," + AnsiString((
short)PrefDirRoute));
16981 bool ElementInRoute =
false;
16982 bool TrainOccupyingRoute =
false;
16988 ElementInRoute =
true;
16992 if(!ElementInRoute)
17020 TrainOccupyingRoute =
true;
17087 if(LRVIT->RouteNumber == RouteNumber)
17101 int button = Application->MessageBox(L
"Train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
17102 L
"Warning!", MB_YESNO | MB_ICONWARNING);
17114 bool ExistingLockedRouteModified =
false;
17127 if(LRVIT->RouteNumber == RouteNumber)
17131 ExistingLockedRouteModified =
true;
17135 if(!ExistingLockedRouteModified)
17225 AnsiString((
short)PrefDirRoute));
17250 AnsiString((
short)PrefDirRoute));
17260 RouteFlashElement.
HLoc = H;
17261 RouteFlashElement.
VLoc = V;
17277 int H = PrefDirPtr->HLoc;
17278 int V = PrefDirPtr->VLoc;
17345 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
17351 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
17354 OverlayPlotted =
false;
17364 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17366 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
17369 return(AllRoutesVector.at(At));
17378 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
17380 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
17383 return(AllRoutesVector.at(At));
17394 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17396 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
17406 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17408 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
17426 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
17427 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
17430 RouteTruncateFlag =
true;
17432 GetModifiableRouteAt(7, a).GetRouteTruncateElement(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
17433 RouteTruncateFlag =
false;
17462 AnsiString(LinkPos));
17463 if(TrackVectorPosition == -1)
17468 THVPair Route2MultiMapKeyPair;
17472 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17475 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17485 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17487 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17490 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
17491 Route2MultiMapIterator->second.second);
17492 EntryLinkPos = PrefDirElement1.
ELinkPos;
17493 ExitLinkPos = PrefDirElement1.
XLinkPos;
17494 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17495 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17507 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17519 Graphics::TBitmap* &EntryDirectionGraphicPtr)
17529 AnsiString(LinkPos));
17532 if(TrackVectorPosition == -1)
17537 THVPair Route2MultiMapKeyPair;
17541 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17544 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17549 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17551 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17553 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
17554 Route2MultiMapIterator->second.second);
17555 EntryLinkPos = PrefDirElement1.
ELinkPos;
17556 ExitLinkPos = PrefDirElement1.
XLinkPos;
17557 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17558 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17562 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
17563 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17570 return(AutoSigsRoute);
17575 return(NotAutoSigsRoute);
17581 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
17582 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
17589 return(AutoSigsRoute);
17594 return(NotAutoSigsRoute);
17598 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17600 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17601 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17603 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
17604 EntryLinkPos = PrefDirElement2.
ELinkPos;
17605 ExitLinkPos = PrefDirElement2.
XLinkPos;
17606 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17607 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17611 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
17618 return(AutoSigsRoute);
17623 return(NotAutoSigsRoute);
17629 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
17636 return(AutoSigsRoute);
17641 return(NotAutoSigsRoute);
17645 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
17646 EntryLinkPos = PrefDirElement3.
ELinkPos;
17647 ExitLinkPos = PrefDirElement3.
XLinkPos;
17648 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17649 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17653 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
17660 return(AutoSigsRoute);
17665 return(NotAutoSigsRoute);
17671 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
17678 return(AutoSigsRoute);
17683 return(NotAutoSigsRoute);
17699 AnsiString(LinkPos));
17700 if(TrackVectorPosition == -1)
17706 THVPair Route2MultiMapKeyPair;
17710 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
17713 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
17719 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
17721 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
17723 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
17724 Route2MultiMapIterator->second.second);
17725 EntryLinkPos = PrefDirElement1.
ELinkPos;
17726 ExitLinkPos = PrefDirElement1.
XLinkPos;
17727 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
17728 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
17731 RouteNumber = Route2MultiMapIterator->second.first;
17735 return(AutoSigsRoute);
17740 return(NotAutoSigsRoute);
17745 RouteNumber = Route2MultiMapIterator->second.first;
17749 return(AutoSigsRoute);
17754 return(NotAutoSigsRoute);
17758 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
17760 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17761 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17763 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
17764 EntryLinkPos = PrefDirElement2.
ELinkPos;
17765 ExitLinkPos = PrefDirElement2.
XLinkPos;
17766 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
17767 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
17770 RouteNumber = ItPair.first->second.first;
17774 return(AutoSigsRoute);
17779 return(NotAutoSigsRoute);
17784 RouteNumber = ItPair.first->second.first;
17788 return(AutoSigsRoute);
17793 return(NotAutoSigsRoute);
17797 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
17798 EntryLinkPos = PrefDirElement3.
ELinkPos;
17799 ExitLinkPos = PrefDirElement3.
XLinkPos;
17800 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
17801 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
17804 RouteNumber = ItPair.second->second.first;
17808 return(AutoSigsRoute);
17813 return(NotAutoSigsRoute);
17818 RouteNumber = ItPair.second->second.first;
17822 return(AutoSigsRoute);
17827 return(NotAutoSigsRoute);
17849 EmptyRoute.
RouteID = NextRouteID;
17852 AllRoutesVector.push_back(EmptyRoute);
17853 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
17878 AllRoutesVector.push_back(EmptyRoute);
17879 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
17902 THVPair Route2MultiMapKeyPair;
17911 LockedRouteTruncateTrackVectorPosition = 0;
17912 LockedRouteLastTrackVectorPosition = 0;
17913 LockedRouteLastXLinkPos = 0;
17914 LockedRouteLockStartTime = TDateTime(0);
17915 if(!LockedRouteVector.empty())
17919 if(LRVIT->RouteNumber == RouteNumber)
17921 LockedRouteTruncateTrackVectorPosition = LRVIT->TruncateTrackVectorPosition;
17922 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
17923 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
17924 LockedRouteLockStartTime = LRVIT->LockStartTime;
17925 LockedRouteFoundDuringRouteBuilding =
true;
17926 LockedRouteVector.erase(LRVIT);
17951 AnsiString(VLoc) +
"," + AnsiString(ELink));
17954 ReturnPair.first = -1;
17955 ReturnPair.second = 0;
17956 THVPair Route2MultiMapKeyPair;
17958 Route2MultiMapKeyPair.first = HLoc;
17959 Route2MultiMapKeyPair.second = VLoc;
17962 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
17963 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
17965 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
17966 Route2MultiMapIterator = ItPair.first;
17968 if(ItPair.first == ItPair.second)
17970 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
17972 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
17974 ReturnPair.first = ItPair.first->second.first;
17975 ReturnPair.second = ItPair.first->second.second;
17976 Route2MultiMapIterator = ItPair.first;
17978 return(ReturnPair);
17981 if(ItPair.first == ItPair.second)
17983 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
17985 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
17987 ReturnPair.first = ItPair.first->second.first;
17988 ReturnPair.second = ItPair.first->second.second;
17989 Route2MultiMapIterator = ItPair.first;
17991 return(ReturnPair);
17994 return(ReturnPair);
18009 AnsiString(VLoc) +
"," + AnsiString(ELink));
18010 THVPair Route2MultiMapKeyPair;
18012 Route2MultiMapKeyPair.first = HLoc;
18013 Route2MultiMapKeyPair.second = VLoc;
18014 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
18016 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18018 if(ItPair.first == ItPair.second)
18024 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
18026 RouteNumber = ItPair.first->second.first;
18032 if(ItPair.first == ItPair.second)
18038 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
18040 RouteNumber = ItPair.first->second.first;
18061 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
18062 THVPair Route2MultiMapKeyPair;
18064 Route2MultiMapKeyPair.first = HLoc;
18065 Route2MultiMapKeyPair.second = VLoc;
18068 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
18071 RouteElementPair.first = RouteNumber;
18072 RouteElementPair.second = RouteElementNumber;
18073 Route2MultiMapEntry.second = RouteElementPair;
18075 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
18078 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
18079 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
18082 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
18083 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
18085 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18087 Route2MultiMap.insert(Route2MultiMapEntry);
18092 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
18097 Route2MultiMap.insert(Route2MultiMapEntry);
18115 TempPair.first = -1;
18116 TempPair.second = 0;
18117 SecondPair = TempPair;
18119 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
18120 THVPair Route2MultiMapKeyPair;
18122 Route2MultiMapKeyPair.first = HLoc;
18123 Route2MultiMapKeyPair.second = VLoc;
18124 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
18129 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
18131 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
18133 return(Route2MultiMapIterator->second);
18135 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
18137 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
18138 TempPair = ItRange.first->second;
18139 SecondPair = (--ItRange.second)->second;
18162 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
18163 if(RouteElementPair.first == -1)
18166 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
18167 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
18169 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
18172 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18173 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
18174 (AnsiString)Caller);
18176 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
18179 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
18180 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
18181 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
18182 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
18186 unsigned int SizeVal = 0;
18189 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
18191 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
18193 if(SizeVal != Route2MultiMap.size())
18195 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
18196 (AnsiString)Caller);
18212 if(!Route2MultiMap.empty())
18214 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18216 if(Route2MultiMapIterator->second.first > RouteNumber)
18218 Route2MultiMapIterator->second.first--;
18235 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
18236 if(!Route2MultiMap.empty())
18238 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
18240 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
18242 Route2MultiMapIterator->second.second--;
18261 AnsiString(ELink));
18265 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
18266 if(RequiredRoutePair.first == -1)
18268 throw Exception(
"Failed to find route element in RemoveRouteElement");
18270 Route2MultiMap.erase(Route2MultiMapIterator);
18271 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
18274 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
18295 GetModifiableRouteAt(8, RequiredRoutePair.first).EraseRouteElementAt(&(GetModifiableRouteAt(9, RequiredRoutePair.first).GetModifiablePrefDirElementAt(1,
18296 RequiredRoutePair.second)));
18307 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
18315 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
18317 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
18318 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
18319 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
18331 if(!LockedRouteVector.empty())
18335 if(LRVIT->RouteNumber > RequiredRoutePair.first)
18337 LRVIT->RouteNumber--;
18347 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
18349 AutoSigVectorIT->RouteNumber--;
18354 CheckMapAndRoutes(7);
18368 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
18369 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
18370 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
18386 "," + AnsiString(XLinkPos));
18390 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
18391 if(RouteElementPair.first == -1)
18393 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
18395 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
18397 RequiredPair = RouteElementPair;
18398 if(RouteElement.
XLinkPos != XLinkPos)
18400 if(SecondPair.first != -1)
18402 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
18403 RequiredPair = SecondPair;
18404 if(RouteElement.
XLinkPos != XLinkPos)
18406 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
18411 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
18415 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
18435 AnsiString(AccessNumber));
18437 int Attribute = AccessNumber + 1;
18439 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
18443 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
18447 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
18450 x).XLinkPos] !=
End)
18452 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
18455 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
18497 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
18498 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
18499 int RearwardLinkedRouteNumber;
18525 int TrainID, TrainPosition, BehindTrainPosition;
18526 bool FoundTrain =
false, BehindTrain =
false;
18527 for(
int x = RouteStartPosition; x >= 0; x--)
18529 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
18554 if(FoundTrain && (TrainPosition > 1))
18556 for(
int x = TrainPosition; x >= 0; x--)
18561 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
18581 BehindTrain =
true;
18582 BehindTrainPosition = x;
18589 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
18606 AnsiString(RouteTruncatePosition));
18607 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber, StartPosition = RouteTruncatePosition;
18608 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
18611 bool ExamineRoute =
true;
18613 while(ExamineRoute)
18615 for(
int x = StartPosition; x >= 0; x--)
18657 if(SignalCount >= 3)
18676 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
18677 ExamineRoute =
true;
18678 StartPosition = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
18713 ExamineRoute =
false;
18728 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
18731 PrefDirElement = InternalPrefDirElement;
18732 if(LockedRouteVector.empty())
18739 bool InLockedRoute =
false;
18743 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
18747 InLockedRoute =
true;
18756 int RouteNumber, VectorCount = 0;
18761 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
18762 if(RouteType == NoRoute)
18768 GetFixedRouteAt(140, RouteNumber).
PrefDirSize() - 1).XLinkPos != LRVIT->LastXLinkPos))
18771 (
"Error, last element in locked route doesn't correspond with last element in associated route in IsElementInLockedRouteGetPrefDirElement");
18773 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
18775 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
18776 if(InternalPrefDirElement.
TrackVectorPosition != (
int)LRVIT->TruncateTrackVectorPosition)
18780 PrefDirElement = InternalPrefDirElement;
18781 LockedVectorNumber = VectorCount;
18786 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->TruncateTrackVectorPosition)
18790 PrefDirElement = InternalPrefDirElement;
18791 LockedVectorNumber = VectorCount;
18812 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18814 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
18820 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
18830 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18832 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
18847 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18849 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
18852 return(GetFixedRouteAt(159, x));
18855 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
18863 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18865 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
18868 return(GetModifiableRouteAt(15, x));
18871 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
18881 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
18883 TOneRoute OneRoute = GetFixedRouteAt(165, x);
18895 int NumberOfRoutes;
18899 for(
int x = 0; x < NumberOfRoutes; x++)
18906 StoreOneRouteAfterSessionLoad(0, &OneRoute);
18924 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
18931 if((NextID < 0) || (NextID > 1000000))
18936 for(
int x = 0; x < NumberOfRoutes; x++)
18961 AnsiString(StartPosition));
18962 if(EndPosition == StartPosition)
18968 int TVPos = EndPosition;
18969 int LkPos = EndXLinkPos;
18971 while(TrackIsInARoute(15, TVPos, LkPos))
18998 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
19007 if((NewLkPos == 0) || (NewLkPos == 2))
19027 if(TVPos == StartPosition)
19059 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
19064 if(FirstPair.first > -1)
19067 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19072 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19078 if(SecondPair.first > -1)
19081 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19086 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19092 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
19099 if(FirstPair.first > -1)
19102 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19107 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19113 if(SecondPair.first > -1)
19116 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19121 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19127 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
19134 if(FirstPair.first > -1)
19137 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19142 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19148 if(SecondPair.first > -1)
19151 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19156 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19162 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
19169 if(FirstPair.first > -1)
19172 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19177 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19183 if(SecondPair.first > -1)
19186 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19191 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19197 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
19221 "," + AnsiString(DiagonalLinkNumber));
19226 if(FirstPair.first > -1)
19229 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19234 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19240 if(SecondPair.first > -1)
19243 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19248 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19255 if(FirstPair.first > -1)
19258 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19263 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19269 if(SecondPair.first > -1)
19272 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19277 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
19284 if(FirstPair.first > -1)
19287 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19292 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19298 if(SecondPair.first > -1)
19301 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19306 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
19313 if(FirstPair.first > -1)
19316 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19321 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
19327 if(SecondPair.first > -1)
19330 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
19335 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))